﻿/*****************************************************************//**
 * @file    FITKGraphObjectModelHighlighting.h
 * @brief   Graph object for highlighting models, such as 'part' and 'instance',
 *          this object can also be used for post model.
 *  
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-05-10
 *********************************************************************/

#ifndef __FITKGRAPHOBJECTMODELHIGHLIGHTING_H__
#define __FITKGRAPHOBJECTMODELHIGHLIGHTING_H__

#include "FITKGraphObject3D.h"

#include "FITKVTKGraphAdaptorAPI.h"

#include <QColor>

// Forward declaration
class vtkAlgorithmOutput;
class vtkDataSet;

class FITKGraphActor;

namespace Exchange
{
    /**
     * @brief   Graph object for highlighting models, such as 'part' and 'assembly'.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-05-10
     */
    class FITKVTKGRAPHADAPTORAPI FITKGraphObjectModelHighlighting : public FITKGraphObject3D
    {
        // Regist
        FITKGraphObjectRegist(FITKGraphObjectModelHighlighting, FITKGraphObject3D);
        FITKCLASS(Exchange, FITKGraphObjectModelHighlighting);

    public:
        /**
         * @brief   Constructor.
         * @param   caseData: The case data
         * @param   dataObj: The model data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-10
         */
        FITKGraphObjectModelHighlighting(AbaqusData::FITKDataCase* caseData, Core::FITKAbstractDataObject* dataObj);

        /**
         * @brief   Destructor.[virtual]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-10
         */
        virtual ~FITKGraphObjectModelHighlighting() = default;

        /**
         * @brief   Show or hide graph object.[virtual][override]
         * @param   visibility: The visibility of graph object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-10
         */
        virtual void setVisible(bool visibility) override;

        /**
         * @brief   Set the model actor's input dataset to the highlighting actor.
         * @param   dataSet: The input connection
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        void setModelInputDataObject(vtkDataSet* dataSet);

        /**
         * @brief   Set the model actor's input connection to the highlighting actor.
         * @param   input: The input connection
         * @param   port: The input port[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-10
         */
        void setModelInputConnection(vtkAlgorithmOutput* input, int port = 0);

        /**
         * @brief   Highlight the graph actors.[override]
         * @param   color: The given color for highlighting this time[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        void highlight(QColor color = QColor()) override;

        /**
         * @brief   Dis-highlight the graph actors.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-23
         */
        void disHighlight() override;

        /**
         * @brief   Set the render representation.
         * @param   rep: The VTK rep enum value
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        void setRepresentation(int rep);

        /**
         * @brief   Enable or disable the transparency by the given value.
         * @param   trans: The transparency
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-27
         */
        void setTransparency(double trans);

        /**
         * @brief   Set the color.[override]
         * @param   color: The color
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-11-29
         */
        void setColor(QColor color) override;

    protected:
        /**
         * @brief   Initialize the actor's visualization properties.[virtual][override]
         * @param   actor: The actor
         * @param   details: No used
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-10
         */
        virtual void initActorProperties(vtkProp* actor, QVariant details = QVariant()) override;
 
    protected:
        /**
         * @brief   The actor for highlight the model.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-05-10
         */
        FITKGraphActor* m_fActorHighlight{ nullptr };

    };
}   // namespace Exchange

#endif // __FITKGRAPHOBJECTMODELHIGHLIGHTING_H__
